import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/viewmodel/food/batch_cancel_food_view_model.dart';

class BatchCancelFoodPage extends BaseStatefulMvvmWidget {
  final int? breakfastId;
  final int? lunchId;
  final int? dinnerId;
  final String? date;

  @override
  State<StatefulWidget> createState() => _BatchCancelFoodState();

  BatchCancelFoodPage(
      {this.breakfastId, this.lunchId, this.dinnerId, this.date});
}

class _BatchCancelFoodState
    extends BaseMvvmState<BatchCancelFoodViewModel, BatchCancelFoodPage> {
  @override
  Widget buildLoadingContentView() {
    return viewModel.contentView();
  }

  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return loadingContentWidget;
  }

  @override
  BatchCancelFoodViewModel createViewModel() {
    return BatchCancelFoodViewModel(context,
        date: widget.date,
        breakfastId: widget.breakfastId,
        lunchId: widget.lunchId,
        dinnerId: widget.dinnerId);
  }

  @override
  void onRetryClick() {}
}

showCancelFoodSheet(BuildContext context,
    {int? breakfastId, int? lunchId, int? dinnerId, String? date}) {
  showModalBottomSheet(
      context: context,
      builder: (context) {
        return SafeArea(
            child: BatchCancelFoodPage(
          breakfastId: breakfastId,
          lunchId: lunchId,
          dinnerId: dinnerId,
          date: date,
        )).addToContainer(
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.vertical(top: 20.radius)));
      },
      backgroundColor: Colors.transparent,
     );
}
